<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

use Gregwar\Captcha\CaptchaBuilder;//验证码

//路由器
Route::get('/','IndexController@index');

Route::get('home',function() {
  return redirect('/');
});

// Authentication routes...
Route::group(
    ['prefix'=>'auth','namespace'=>'Auth'],
    function(){
      Route::get('login', 'AuthController@getLogin');
      Route::post('login', 'AuthController@postLogin');
      Route::get('logout', 'AuthController@getLogout');
      Route::get('register','AuthController@getRegister');
    }
);
/*Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');
// Registration routes...
Route::get('auth/register','Auth\AuthController@getRegister');
*/
//中间件
 Route::post('auth/register',
 [
   'middleware'=>'App\Http\Middleware\EmailMiddleware',
   'uses'=>'Auth\AuthController@postRegister',
 ]);

Route::get('jie','ProController@jie');
Route::post('jie','ProController@jiePost');
Route::get('pro/{pid}','ProController@pro');
//我要投资
Route::post('touzi/{pid}','ProController@touzi');

Route::get('prolist','CheckController@prolist');
//审核路由
Route::get('check/{pid}','CheckController@check');//有问题
Route::post('check/{pid}','CheckController@checkpost');
//收益路由
// Route::get('run','GrowController@run');

Route::get('myzd',
[ 'middleware'=>'auth',
  'uses'=>'IndexController@myzd'
]
);//账单
Route::get('mytz','IndexController@mytz');//投资
Route::get('mysy','IndexController@mysy');//收益

Route::get('middle',
[
  'middleware'=>'App\Http\Middleware\EmailMiddleware',
  'uses'=>'IndexController@middle',
]);

Route::get('mini',
[
  'middleware'=>'App\Http\Middleware\CaptchaMiddleware',
  'uses'=>'IndexController@mini',
]);

Route::get('hh',function(){
  $builder = new CaptchaBuilder;
  $builder->build(150,32);
  Session::set('phrase',$builder->getPhrase()); //存储验证码
  return response($builder->output())->header('Content-type','image/jpeg');
});


Route::get('Captcha/captcha/{tmp}', 'CaptchaController@captcha');
